package xiaohu.day7.HJ75;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            // 输入、并令str1.length() < str2.length()
            String str1 = scanner.nextLine();
            String str2 = scanner.nextLine();
            if (str1.length() > str2.length()) {
                String temp = str1;
                str1 = str2;
                str2 = temp;
            }

            //求公共子串
            int[][] dp = new int[str1.length() + 1][str2.length() + 1];
            for (int i = 1; i <= str1.length(); i++) {
                for (int j = 2; j <= str2.length(); j++) {
                    if (str1.charAt(i - 1) == str2.charAt(j - 1)) {
                        dp[i][j] = dp[i - 1][j - 1] + 1;
                    }
                }
            }

            //找到最大值并输出
            int max = 0;
            for (int i = 0; i <=str1.length(); i++) {
                for (int j = 0; j <=str2.length(); j++) {
                    if (dp[i][j] > max) {
                        max=dp[i][j];
                    }
                }
            }
            System.out.println(max);
        }
    }
}
